<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>我的客户</title>
    <meta content="width=device-width,initial-scale=1.0,minimum-scale=1.0.maximum-scale=1.0,user-scalable=no" name="viewport">
    <link rel="stylesheet" href="css/reset.css">
    <link rel="stylesheet" href="css/bossIndex.css">
    <link rel="stylesheet" href="css/flexible.css">
    <link rel="stylesheet" href="css/vant.css">
    <script src="js/fontsize.js"></script>
    <script src="js/vue/vue.js"></script>
    <script src="js/vue/axios.js"></script>
    <script src="js/jquery.md5.js"></script>
    <script src="js/glabe.js"></script>
    <script src="js/jquery.md5.js"></script>
    <script src="js/vue/qs.js"></script>
    <script src="js/vue/vant.js"></script>
<body>
<div class="container_box" id="app" style="padding-top: 0;">
    <div class="add_jl">
        <a href="addVisitor.html">
            <img src="images/add_jl.png">
        </a>
    </div>
    <template>
        <div class="group_details group_details_state clearfix" style="padding-right: 0.1rem;" @click="visitorDetails(item.Uid)" v-for="item in visitorList">
            <div class="fl head_card">
                <img :src="item.Picurl ? item.Picurl : 'images/xiaoxiao_img_74.png'" alt="" class="spinning_img">
            </div>
            <div class="spinning_txt fl">
                <div class="margin_bottom" style="display: flex;justify-content: space-between;padding-left:0.1rem;align-items: center;">
                    <div style="display: flex;align-items: center;">
                        <span>{{item.Username}}</span>
                        <img src="images/woman.png"/ v-if="item.Sex == 0" style="width: 0.14rem;height: 0.14rem;margin-left: 0.1rem;">
                        <img style="width: 0.14rem;height: 0.14rem;margin-left:0.1rem;" src="images/man.png"/ v-else>
                    </div>
                    <div class="rf">
                        <span>维护人:</span>
                        <span>{{item.Sname}}</span>
                    </div>
                </div>
                <p class="margin_bottom">
                    <span class="spinning_name" style="font-size: .12rem;">{{item.Phone}}</span>
                    <span class="font_size12 rf">
                        <span style="font-size: .12rem;">日期</span>
                        <span style="font-size: .12rem;">{{item.Addtime}}</span>
                    </span>
                </p>
            </div>
        </div>
        <van-list
            v-model="loading"
            :finished="finished"
            finished-text="没有更多了"
            @load="getList"
            >
            <van-cell
                v-for="item in lists"
                :key="item"
                :title="item"
            />
        </van-list>
    </template>
</div>
</body>
<script>
    var app = new Vue({
        el: '#app',
        data: {
            //访客列表
            visitorList:[],
            lists:[],
            loading: false,
            finished: false,
            totalnum:'',
            from:{
                page:'1'
            },
            listd:[],
        },
        methods: {
            getList(){
                const params=this.from
                axios.get('mobileapi/boss/customer.php?act=list',{params:params}).then(res => {
                    let { msg, code} = res.data
                        if (code !== 200) {
                            vant.Toast('请求发送失败，请重试')
                        } else {
                            data=res.data
                            this.listd=data.data.list
                            this.totalnum=data.data.totalnum
                            this.from.page=parseInt(data.data.page)+1
                            for(let i in this.listd){
                                if(this.listd[i].Picurl==""||this.listd[i].Picurl==null){
                                    this.listd[i].Picurl='images/moren.png'
                                }
                            }
                            for (let i = 0; i < this.listd.length; i++) {
                                this.visitorList.push(this.listd[i])
                            }
                            // 加载状态结束
                            this.loading = false
                            // 数据全部加载完成
                            if (this.visitorList.length >= this.totalnum) {
                                this.finished = true
                            }
                        }
                }).catch(err => {
                    vant.Toast('请求发送失败，请重试')
                })
            },
            visitorDetails(id){
                window.location.href="visitorDetails.html?id="+id;
            }
        },
    })
</script>
</html>